﻿using Group3.MediaTool.Core.ObjectGenerator;
using Group3.MediaTool.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Group3.MediaTool.OWIN.Model
{
    public class FieldWebDefinition : IFieldWebDefinition
    {
        public string Name { get; set; }
        public string PType { get; set; }
        public int Counter { get; set; }
        public IFieldDefinition ToIFieldDefinition()
        {
            try
            {
                IFieldDefinition def = new FieldDefinition();
                def.FieldName = Name;
                switch(PType)
                {
                    case "String":
                        def.ValueType = e_ValueType.String;
                        break;
                    default:
                        def.ValueType = e_ValueType.Unknown;
                        break;
                }
                return def;
            }
            catch
            {
                return null;
            }
        }
    }
}
